package org.spring.core.type.classreading;

import java.util.Map;

import org.objectweb.asm.AnnotationVisitor;
import org.spring.core.annotation.AnnotationAttributes;

public class AnnotationAttributesReadingVisitor extends AnnotationVisitor {

	private final String annotationType;

	private final Map<String, AnnotationAttributes> attributesMap;

	AnnotationAttributes attributes = new AnnotationAttributes();

	public AnnotationAttributesReadingVisitor(String annotationType, Map<String, AnnotationAttributes> attributesMap) {
		super(327680);

		this.annotationType = annotationType;
		this.attributesMap = attributesMap;

	}

	@Override
	public final void visitEnd() {
		this.attributesMap.put(this.annotationType, this.attributes);
	}

	public void visit(String attributeName, Object attributeValue) {
		this.attributes.put(attributeName, attributeValue);
	}

}
